package test

import office._

/**
 * @author: Yardena
 * @date: Oct 12, 2009 9:46:42 AM
 */

object Test3 {
//  def main(args : Array[String]) {
//    val e = new Employee
//    println(e.name)
//    println(e.id)
//  }
//
//  class Value[+V](v: V)
//  trait Column[V] {
//    type Val = V
//    type $ = Value[Val]
//    type C <: Column[_]
//    def  $value: $
//  }
//  trait Table2[T] { table: T =>  // Table2[T <: Table2[T]]
//    type C1 <: Column[_]
//    trait Column1 extends Column[C1#Val] {
//      override type C = C1
//      override def $value = table.values._1
//    }
//    type C2 <: Column[_]
//    trait Column2 extends Column[C2#Val] {
//      override type C = C2
//      override def $value = table.values._2
//    }
//    def columns: (C1 with Column1, C2 with Column2)
//    def values:  (Value[C1#Val],   Value[C2#Val])
//
////    def select[S1<:Column[_]](c1: S1)
////    def select[S1<:Column[_],S2<:Column[_]](c1: S1, c2: S2)
//
//  }
//  class Projection1[S1<:Column[_]](val c1: S1) {
//    type C1 = S1
//    val columns = (c1)
//    val values = (c1.$value)
//  }
//  class Projection2[S1<:Column[_],S2<:Column[_]](val c1: S1, val c2: S2) {
//    type C1 = S1
//    type C2 = S2
//    val columns = (c1,c2)
//    val values = (c1.$value,c2.$value)
//  }
//
//  trait Table2Def[T<:Table2[T]] {
//    implicit def as1(table: T): T#C1 = table.columns._1 //(implicit factory: ColumnFactory[T]): T#C1 = factory.apply1(table)
//    implicit def as2(table: T): T#C2 = table.columns._2 //(implicit factory: ColumnFactory[T]): T#C2 = factory.apply2(table)
//  }
//  class Employee extends Table2[Employee] {
////    trait NameColumn extends Column[String] { def name = $value }
////    trait IdColumn   extends Column[Int]    { def id   = $value }
//    override type C1 = Column[String] { def name: $ }//NameColumn
//    override type C2 = Column[Int]    { def id:   $ }//IdColumn
//    override val columns = (new Column1 { def name = $value }, new Column2 { def id = $value })
//    override val values =  (new Value[String](t._1),           new Value[Int](t._2))
//    val t =   ("foo",1)
//  }
//  object Employee extends Table2Def[Employee]
////  {
////    object Name { def apply(e:Employee) = e.columns._1 }
////    object Id   { def apply(e:Employee) = e.columns._2 }
////  }
//
////  trait ColumnFactory[T <: Table2[T]] {
////    def apply1(table: T):T#C1
////    def apply2(table: T):T#C2
////  }
}
